package com.neusoft.yuejian_6.model;

import com.neusoft.yuejian_6.service.CollectService;

import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

import static com.neusoft.yuejian_6.base.Constant.BASE_URL;

/**
 * Created by Q on 2017/11/2.
 */

public class CollectModel {
    private Retrofit retrofit;
    private CollectService collectService;
    public CollectModel(){
        retrofit = new Retrofit
                .Builder()
                .baseUrl(BASE_URL)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }
    private void service(){
        collectService = retrofit.create(CollectService.class);
    }
    //判断是否收藏
    public Call isCollected(int user_id, int id, int flag){
        service();
        return collectService.isCollect(user_id,id,flag);
    }
    //收藏活动
    public Call collectActivity(int user_id,int activity_id){
        service();
        return collectService.userCollectActivity(user_id,activity_id);
    }
    //收藏比赛
    public Call collectContest(int user_id,int contest_id){
        service();
        return collectService.userCollectContest(user_id,contest_id);
    }
    //收藏大师
    public Call collectMaster(int user_id,int master_id){
        service();
        return collectService.userCollectMaster(user_id,master_id);
    }
    //收藏用户
    public Call collectUser(int user_id,int usered_id){
        service();
        return collectService.userCollectUser(user_id,usered_id);
    }
    public Call uncollectShop(int user_id,int shop_id){
        service();
        return collectService.userCollectActivity(user_id,shop_id);
    }
    public Call collectClass(int user_id, int class_id){
        service();
        return collectService.userCollectClass(user_id, class_id);
    }
    //收藏比赛
//    public Call collectClass(int user_id,int class_id){
//        service();
//        return collectService.userCollectContest(user_id,class_id);
//    }
}
